package com.project.bean;

import com.project.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service;

@Service

public class Manager {
    @Autowired   //自动注入  扫描已注册的spring组件，注入匹配该属性的组件  只能有一个实现类
    @Qualifier("User") //多实现类 就通过Qualifier 按名称注入该接口组件
    private IUserService service;

    public void add(){
        service.speak();
    }
}
